﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;

namespace Aphysoft.Vate
{
    public partial class Vate
    {
        #region Properties
        /// <summary>
        /// Game assets directory
        /// </summary>
        private static string contentRootDirectory = "Content";
        /// <summary>
        /// Gets content directory for all game assets.
        /// </summary>
        public static string ContentRootDirectory
        {
            get { return contentRootDirectory; }
        }
        /// <summary>
        /// Game Content Manager.
        /// </summary>
        private static ContentManager content = null;
        /// <summary>
        /// Game Content Manager. 
        /// </summary>
        public static new ContentManager Content
        {
            get { return content; }
            set { content = value; }
        }
        #endregion

        #region Methods
        /// <summary>
        /// Loads an asset that has been processed by the Content Pipeline.
        /// </summary>
        /// <param name="assetPath">Asset path relative to content root directory.</param>
        public static T Load<T>(string assetPath)
        {
            return Content.Load<T>(assetPath);
        }
        /// <summary>
        /// Loads an asset that has been processed by the Content Pipeline
        /// </summary>
        /// <param name="assetCategory">Asset category.</param>
        /// <param name="assetName">Asset name.</param>
        public static T Load<T>(string assetCategory, string assetName)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(assetCategory);
            sb.Append("/");
            sb.Append(assetName);

            return Load<T>(sb.ToString());
        }
        /// <summary>
        /// Loads an built-in asset that has been processed by the Content Pipeline.
        /// </summary>
        /// <param name="assetPath">Asset path relative to content root directory.</param>
        public static T VateLoad<T>(string assetPath)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Vate/");
            sb.Append(assetPath);

            return Content.Load<T>(sb.ToString());
        }
        /// <summary>
        /// Loads an built-in asset that has been processed by the Content Pipeline
        /// </summary>
        /// <param name="assetCategory">Asset category.</param>
        /// <param name="assetName">Asset name.</param>
        public static T VateLoad<T>(string assetCategory, string assetName)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(assetCategory);
            sb.Append("/");
            sb.Append(assetName);

            return VateLoad<T>(sb.ToString());
        }
        #endregion
    }
}
